<template>
	<view>
		<view class="content">
			<view class="item" v-for="(item, index) in data" :key="index" @tap="info(item)">
				<view class="left">
					<view class="img">
						<img class="img_item" :src="item.picUrl" alt="">
					</view>
				</view>
				<view class="right">
					<h1 class="title">{{item.name}}</h1>
					<view class="intro">
						{{item.miniProgramDescription}}
					</view>

					<view v-if="equipment !== 'ios' || equipment == 'macos'" class="money">
						<span class="needMoney">￥{{item.realPrice}}</span>
						<span class="originalPrice"> 原价{{item.basePrice}}</span>
					</view>

				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: [],
				equipment: '',
				chkiospay: false
			}
		},
		onLoad() {
			// 分享
			wx.showShareMenu({
				withShareTicket: true,
				menus: ['shareAppMessage', 'shareTimeline'] // 分享到朋友圈
			});
			this.getList()
		},
		onShow() {
			this.equipment = uni.getSystemInfoSync('systemInfo').osName
			this.chkiospay = uni.getStorageSync('chkiospay')
		},
		// //监听用户分享到朋友
		// onShareAppMessage() {
		// 	let data = JSON.stringify(this.schoolDataMessage);
		// 	return {
		// 			title: "商品服务", // 分享标题
		// 		imageUrl: this.$1740203073,
		// 		path: `/pages/tabBar/commodityService/commodityService` // 分享路径，通常是当前页面路径
		// 	};
		// },
		// //监听用户分享到朋友圈
		// onShareTimeline() {
		// 	let data = JSON.stringify(this.schoolDataMessage);
		// 	return {
		// 		title: "商品服务", // 分享标题
		// 		imageUrl: this.$1740203073,
		// 		path: `/pages/tabBar/commodityService/commodityService` // 分享路径，通常是当前页面路径
		// 	};
		// },
		methods: {
			getList() {
				this.$request.goodsList().then(res => {
					this.data = res.data
				})
			},
			info(item) {
				// 传值
				uni.navigateTo({
					url: '/subpackages/subpackage1/pages/commodityService/enrollmentplanInfo?title=' + item.name +
						'&id=' + item.id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		.item {
			display: flex;
			flex-direction: row;
			margin: 38rpx 0 0 32rpx;

			.left {
				.img {
					width: 258rpx;
					height: 196rpx;
					border-radius: 16rpx;

					.img_item {
						width: 258rpx;
						height: 196rpx;
					}
				}
			}

			.right {
				width: 420rpx;
				margin-left: 26rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: flex-start;

				.title {
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 36rpx;
					color: #333333;
					line-height: 50rpx;
					text-align: left;
					font-style: normal;
					display: inline-block;
					margin: 18rpx 0 0 0;
				}

				.intro {
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 24rpx;
					color: #C9C9C9;
					line-height: 34rpx;
					text-align: left;
					font-style: normal;
					margin-left: 10rpx;
					width: 100%;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}

				.money {
					display: flex;
					flex-direction: row;
					align-items: center;

					.needMoney {
						font-family: HelloFont, HelloFont;
						font-weight: normal;
						font-size: 36rpx;
						color: #FF3B0A;
						line-height: 46rpx;
						text-align: left;
						font-style: normal;
					}

					.originalPrice {
						text-decoration: line-through;
						font-family: PingFangSC, PingFang SC;
						font-weight: 600;
						font-size: 24rpx;
						color: #C9C9C9;
						line-height: 34rpx;
						text-align: left;
						font-style: normal;
						margin-left: 10rpx;
					}
				}
			}
		}
	}
</style>